<clickhouse>
    <logger>
        <level>warning</level>
        <log>{{ ck_datadir }}/keeper/log/clickhouse-keeper/clickhouse-keeper.log</log>
        <errorlog>{{ ck_datadir }}/keeper/log/clickhouse-keeper/clickhouse-keeper.err.log</errorlog>
        <size>1000M</size>
        <count>10</count>
    </logger>

    <listen_host>0.0.0.0</listen_host>
    <max_connections>4096</max_connections>

    <keeper_server>
            <tcp_port>{{ ck_keeper_port | default(9181) }}</tcp_port>
            <server_id>{{ keeper_id }}</server_id>
            <storage_path>{{ ck_datadir }}/keeper</storage_path>
            <log_storage_path>{{ ck_datadir }}/keeper/coordination/logs</log_storage_path>
            <snapshot_storage_path>{{ ck_datadir }}/keeper/coordination/snapshots</snapshot_storage_path>

            <coordination_settings>
                <operation_timeout_ms>10000</operation_timeout_ms>
                <min_session_timeout_ms>10000</min_session_timeout_ms>
                <session_timeout_ms>100000</session_timeout_ms>
                <raft_logs_level>information</raft_logs_level>
                <compress_logs>true</compress_logs>
            </coordination_settings>

            <!-- enable sanity hostname checks for cluster configuration (e.g. if localhost is used with remote endpoints) -->
            <hostname_checks_enabled>true</hostname_checks_enabled>
        <raft_configuration>
            {% for host in groups['clickhouse'] if hostvars[host].keeper_id is defined %}
                <server>
                    <id>{{ hostvars[host].keeper_id }}</id>
                    <hostname>{{ hostvars[host].ansible_host }}</hostname>
                    <port>9234</port>
                </server>
            {% endfor %}
        </raft_configuration>
    </keeper_server>

    <openSSL>
      <server>
            <verificationMode>none</verificationMode>
            <loadDefaultCAFile>true</loadDefaultCAFile>
            <cacheSessions>true</cacheSessions>
            <disableProtocols>sslv2,sslv3</disableProtocols>
            <preferServerCiphers>true</preferServerCiphers>
        </server>
    </openSSL>

</clickhouse>
